package com.xugongzhang.api;

import java.util.concurrent.CompletableFuture;

/**
 * @author X
 * @date 2022/6/29 1:40
 */
public class CompletableFutureApi3Demo {
    public static void main(String[] args) {
        System.out.println(CompletableFuture.supplyAsync(() -> 1).thenRun(() -> {}).join());
        System.out.println(CompletableFuture.supplyAsync(() -> 2).thenAccept(System.out::println).join());
        System.out.println(CompletableFuture.supplyAsync(() -> 3).thenApply(f -> f + 4).join());
    }
}
